import React from 'react';
import { Input as AntdInput } from 'antd';
import type { InputProps as AntdInputProps } from 'antd';

// 导出样式扩展 Hook，方便用户使用特殊效果
export { useInputStyles } from './style';

export interface InputProps extends AntdInputProps {
  /**
   * @description 自定义样式类名
   */
  customClassName?: string;
}

const InputComponent: React.FC<InputProps> = ({ customClassName, className, ...restProps }) => {
  const inputClassName = customClassName || className;

  return <AntdInput className={inputClassName} {...restProps} />;
};

type InputType = typeof InputComponent & {
  TextArea: typeof AntdInput.TextArea;
  Password: typeof AntdInput.Password;
  Search: typeof AntdInput.Search;
  Group: typeof AntdInput.Group;
  OTP: typeof AntdInput.OTP;
};

const Input = InputComponent as InputType;
Input.TextArea = AntdInput.TextArea;
Input.Password = AntdInput.Password;
Input.Search = AntdInput.Search;
Input.Group = AntdInput.Group;
Input.OTP = AntdInput.OTP;

export { Input };
export default Input;

